import request, { $request }/*, { $http as http }*/ from '@/utils/request';
import { formatParams } from '@/utils'
import api from '@/api'

/**
 * 用户信息
 */
export const getOne = async (params) => {
  return request(api.user_get, {
    params,
  });
};

/**
 * 删除用户
 */
export const deleteRows = async (data) => {
    return request.post(api.user_remove, {
        data,
    });
};

/**
 * 锁定用户
 */
export const lock = async (data) => {
    return request.post(api.user_lock, {
        data,
    });
};

/**
 * 解锁用户
 */
export const unlock = async (data) => {
    return request.post(api.user_unlock, {
        data,
    });
};

/**
 * 验证用户名称
 */
export const check = async (params) => {
    // return http.post(api.user_name_valid, {
    //     data,
    //     type: true,
    //     requestType: 'form'
    // });
    return $request(api.user_name_valid, {
      params,
    })
};

/**
 * 用户列表
 */
export const getList = async (data) => {
  const params = formatParams(data);
  return request(api.user_list, {
    params,
  });
};
